<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" charset="utf-8" src="${ctx}/static/inspinia/js/plugins/ueditor-1.4.3.3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctx}/static/inspinia/js/plugins/ueditor-1.4.3.3/_examples/editor_api.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctx}/static/inspinia/js/plugins/ueditor-1.4.3.3/lang/zh-cn/zh-cn.js"></script>

</head>

<body>

<div id="wrapper">
    <div class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <form method="post" data-ajax="${ctx}/medical/sign/spck/item/lists?teamIds=${teamId}&ecn=${ecn}&signId=${signId}&spckId=${spckId}&prid=${prid}" action="${ctx}/medical/sign/record/add" class="form-horizontal" id="resident_form">
                                <input type="hidden" name="ecn" value="${ecn}"/>
                                <input type="hidden" name="sirid" value="${srid}"/>
                                <input type="hidden" name="itemCode" value="${item.code}"/>
                                <input type="hidden" name="itemId" value="${item.id}"/>
                                <input type="hidden" name="packageCode" value="${spck.code}"/>
                                <input type="hidden" name="packageId" value="${spck.id}"/>
                                <input type="hidden" name="teamId" value="${teamId}"/>
                                <input type="hidden" name="signId" value="${signId}"/>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务居民</label>
                                    <div class="col-sm-3">
                                        <input id="ename" type="text" class="form-control"
                                               placeholder="请输入" value="${medResident.title}" name="ename" readonly>
                                    </div>
                                    <label class="col-sm-2 control-label">联系方式</label>
                                    <div class="col-sm-3">
                                        <input id="emobile" type="text" class="form-control"
                                               placeholder="请输入" value="${medResident.mobile}" name="emobile" readonly>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务项目</label>
                                    <div class="col-sm-3">
                                        <input id="itemTitle" type="text" class="form-control"
                                               placeholder="请输入" value="${item.title}" name="itemTitle" readonly>
                                    </div>
                                    <label class="col-sm-2 control-label">服务包</label>
                                    <div class="col-sm-3">
                                        <input id="packageTitle" type="text" class="form-control"
                                               placeholder="请输入" value="${spck.title}" name="packageTitle" readonly>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务团队</label>
                                    <div class="col-sm-3">
                                        <input id="teamName" type="text" class="form-control"
                                               placeholder="请输入" value="${team.teamName}" name="teamName" readonly>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><span class="text-danger">*</span>服务人</label>
                                    <div class="col-sm-10">
                                        <select id="ll" name="servantId"  class=" form-control" items="${mhInfo.srcId}"  style="width:20%" required>
                                            <option value=""></option>
                                            <c:forEach items="${members}" var="c" >
                                                <option value="${c.servantId}">${c.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">记录说明</label>
                                    <div class="col-sm-8"><textarea class="form-control" name="details" style="height: 100px;"></textarea></div>
                                </div>
                                <%--<div class="form-group">
                                    <label class="col-sm-2 control-label">上传图片</label>
                                <div id="zyupload" class="zyupload"></div>
                                    </div>--%>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">上传图片</label>
                                    <div class="col-sm-2">
                                    <input  type="hidden" id="src" name="image1" value="" required/>
                                    <div class="imager" id="srcView">
                                        <img src="${ctx}/static/inspinia/img/default_pic_no.jpg" width="100%" height="100%">
                                    </div>
                                </div>
                                    <div class="col-sm-3 upload-img-pt25">
                                        <div class="upload f-fl" id="uploaderLogoUrl"></div>
                                        <div class="tip f-fl upload-img-pt10"><span class="upload-img-ml6"></span></div>
                                    </div>
                                    <div class="col-sm-2">
                                        <input  type="hidden" id="src1" name="image2" value="" required/>
                                        <div class="imager" id="srcView1" hidden="">
                                            <img src="${ctx}/static/inspinia/img/default_pic_no.jpg" width="100%" height="100%">
                                        </div>
                                    </div>
                                    <div class="col-sm-3 upload-img-pt25">
                                        <div class="upload f-fl" id="uploaderLogoUrl1" hidden=""></div>
                                        <div class="tip f-fl upload-img-pt10"><span class="upload-img-ml6"></span></div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-2">
                                        <input  type="hidden" id="src2" name="image3" value="" required/>
                                        <div class="imager" id="srcView2" hidden="">
                                            <img src="${ctx}/static/inspinia/img/default_pic_no.jpg" width="100%" height="100%">
                                        </div>
                                    </div>
                                    <div class="col-sm-3 upload-img-pt25">
                                        <div class="upload f-fl" id="uploaderLogoUrl2" hidden=""></div>
                                        <div class="tip f-fl upload-img-pt10"><span class="upload-img-ml6"></span></div>
                                    </div>

                                    <div class="col-sm-2">
                                        <input  type="hidden" id="src3" name="image4" value="" required/>
                                        <div class="imager" id="srcView3" hidden="">
                                            <img src="${ctx}/static/inspinia/img/default_pic_no.jpg" width="100%" height="100%">
                                        </div>
                                    </div>
                                    <div class="col-sm-3 upload-img-pt25">
                                        <div class="upload f-fl" id="uploaderLogoUrl3" hidden=""></div>
                                        <div class="tip f-fl upload-img-pt10"><span class="upload-img-ml6"></span></div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-2">
                                        <input  type="hidden" id="src4" name="image5" value="" required/>
                                        <div class="imager" id="srcView4" hidden="">
                                            <img src="${ctx}/static/inspinia/img/default_pic_no.jpg" width="100%" height="100%">
                                        </div>
                                    </div>
                                    <div class="col-sm-3 upload-img-pt25">
                                        <div class="upload f-fl" id="uploaderLogoUrl4" hidden=""></div>
                                        <div class="tip f-fl upload-img-pt10"><span class="upload-img-ml6"></span></div>
                                    </div>

                                    <div class="col-sm-2">
                                        <input  type="hidden" id="src5" name="image6" value="" required/>
                                        <div class="imager" id="srcView5" hidden="">
                                            <img src="${ctx}/static/inspinia/img/default_pic_no.jpg" width="100%" height="100%">
                                        </div>
                                    </div>
                                    <div class="col-sm-3 upload-img-pt25">
                                        <div class="upload f-fl" id="uploaderLogoUrl5" hidden=""></div>
                                        <div class="tip f-fl upload-img-pt10"><span class="upload-img-ml6"></span></div>
                                    </div>
                                </div>


                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn" type="button" onclick="save()">保 存</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="${ctx}/static/inspinia/js/plugins/LD.sot/multiupf/uploadify2/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="${ctx}/static/inspinia/js/plugins/LD.sot/multiupf/uploadify2/swfobject.js"></script>
<script type="text/javascript" src="${ctx}/static/inspinia/js/plugins/LD.sot/multiupf/multiupf.uploadify2.js"></script>
<link rel="stylesheet" href="${ctx}/static/zyupload/skins/zyupload-1.0.0.min.css " type="text/css">
<script type="text/javascript" charset="utf-8" src="${ctx}/static/zyupload/zyupload.basic-1.0.0.min.js"></script>
<script>


    $(document).ready(function() {
        init_src();
        // 初始化插件
        $("#zyupload").zyUpload({
            width            :   "650px",                 // 宽度
            height           :   "400px",                 // 宽度
            itemWidth        :   "140px",                 // 文件项的宽度
            itemHeight       :   "115px",                 // 文件项的高度
            url              :   '${ctx}/book/ajaxFileUpload',  // 上传文件的路径
            fileType         :   ["jpg","png","js","exe"],// 上传文件的类型
            fileSize         :   51200000,                // 上传文件的大小
            multiple         :   true,                    // 是否可以多个文件上传
            dragDrop         :   false,                   // 是否可以拖动上传文件
            tailor           :   false,                   // 是否可以裁剪图片
            del              :   true,                    // 是否可以删除文件
            finishDel        :   false,  				  // 是否在上传文件完成后删除预览
            /* 外部获得的回调接口 */
            onSelect: function(selectFiles, allFiles){    // 选择文件的回调方法  selectFile:当前选中的文件  allFiles:还没上传的全部文件
                console.info("当前选择了以下文件：");
                console.info(selectFiles);
            },
            onDelete: function(file, files){              // 删除一个文件的回调方法 file:当前删除的文件  files:删除之后的文件
                console.info("当前删除了此文件：");
                console.info(file.name);
            },
            onSuccess: function(file, response){          // 文件上传成功的回调方法
                console.info("此文件上传成功：");
                console.info(file.name);
                console.info("此文件上传到服务器地址：");
                console.info(response);
                $("#uploadInf").append("<p>上传成功，文件地址是：" + response + "</p>");
            },
            onFailure: function(file, response){          // 文件上传失败的回调方法
                console.info("此文件上传失败：");
                console.info(file.name);
            },
            onComplete: function(response){           	  // 上传完成的回调方法
                console.info("文件上传完成");
                console.info(response);
            }
        });

    });


    function save() {
        $('#resident_form').submit();
    }

    function init_src() {
        init_uploader('uploaderLogoUrl', 'srcView', 'src');
        init_uploader1('uploaderLogoUrl1', 'srcView1', 'src1');
        init_uploader2('uploaderLogoUrl2', 'srcView2', 'src2');
        init_uploader3('uploaderLogoUrl3', 'srcView3', 'src3');
        init_uploader4('uploaderLogoUrl4', 'srcView4', 'src4');
        init_uploader5('uploaderLogoUrl5', 'srcView5', 'src5');
    }

    function init_uploader(id, view_id, url_id,del_btn) {
        $('#'+id).multiupf({
            uploader: '${image_upload_url}',
            fileExts: '*.png;*.jpg;', fileDesc: '*.png;*.jpg;',
            progress: function (data, queue) {
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html("上传中...");
                }
            },
            complete: function (result, queue) {
                var url = result.data[0];
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html('<img data-img src="' + url + '"  width="100%" height="100%">');
                    $('#'+url_id).val(url);
                    $("#"+del_btn).show();
                    $("#srcView1").show();
                    $("#uploaderLogoUrl1").show();
                }
            }
        });
    }

    function init_uploader1(id, view_id, url_id,del_btn) {
        $('#'+id).multiupf({
            uploader: '${image_upload_url}',
            fileExts: '*.png;*.jpg;', fileDesc: '*.png;*.jpg;',
            progress: function (data, queue) {
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html("上传中...");
                }
            },
            complete: function (result, queue) {
                var url = result.data[0];
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html('<img data-img src="' + url + '"  width="100%" height="100%">');
                    $('#'+url_id).val(url);
                    $("#"+del_btn).show();
                    $("#srcView2").show();
                    $("#uploaderLogoUrl2").show();
                }
            }
        });
    }

    function init_uploader2(id, view_id, url_id,del_btn) {
        $('#'+id).multiupf({
            uploader: '${image_upload_url}',
            fileExts: '*.png;*.jpg;', fileDesc: '*.png;*.jpg;',
            progress: function (data, queue) {
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html("上传中...");
                }
            },
            complete: function (result, queue) {
                var url = result.data[0];
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html('<img data-img src="' + url + '"  width="100%" height="100%">');
                    $('#'+url_id).val(url);
                    $("#"+del_btn).show();
                    $("#srcView3").show();
                    $("#uploaderLogoUrl3").show();
                }
            }
        });
    }

    function init_uploader3(id, view_id, url_id,del_btn) {
        $('#'+id).multiupf({
            uploader: '${image_upload_url}',
            fileExts: '*.png;*.jpg;', fileDesc: '*.png;*.jpg;',
            progress: function (data, queue) {
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html("上传中...");
                }
            },
            complete: function (result, queue) {
                var url = result.data[0];
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html('<img data-img src="' + url + '"  width="100%" height="100%">');
                    $('#'+url_id).val(url);
                    $("#"+del_btn).show();
                    $("#srcView4").show();
                    $("#uploaderLogoUrl4").show();
                }
            }
        });
    }
    function init_uploader4(id, view_id, url_id,del_btn) {
        $('#'+id).multiupf({
            uploader: '${image_upload_url}',
            fileExts: '*.png;*.jpg;', fileDesc: '*.png;*.jpg;',
            progress: function (data, queue) {
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html("上传中...");
                }
            },
            complete: function (result, queue) {
                var url = result.data[0];
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html('<img data-img src="' + url + '"  width="100%" height="100%">');
                    $('#'+url_id).val(url);
                    $("#"+del_btn).show();
                    $("#srcView5").show();
                    $("#uploaderLogoUrl5").show();
                }
            }
        });
    }
    function init_uploader5(id, view_id, url_id,del_btn) {
        $('#'+id).multiupf({
            uploader: '${image_upload_url}',
            fileExts: '*.png;*.jpg;', fileDesc: '*.png;*.jpg;',
            progress: function (data, queue) {
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html("上传中...");
                }
            },
            complete: function (result, queue) {
                var url = result.data[0];
                if (queue.indexOf(id) > -1) {
                    $('#'+view_id).html('<img data-img src="' + url + '"  width="100%" height="100%">');
                    $('#'+url_id).val(url);
                    $("#"+del_btn).show();
                }
            }
        });
    }

</script>
</body>
</html>
